<script setup lang="ts">
	import { useUserStore } from '@/stores/user'
	import { route } from '@/uni_modules/uview-plus'
	const { userInfo } = useUserStore()

	// 跳转页面
	const toPage = (url : string) => {
		route({
			url
		})
	}
</script>
<template>
	<view class="content">
		<view class="content-header">
			<view class="header-name">工作台</view>
			<view style="display: flex;justify-content: space-between;">
				<view class="header-left">
					<view class="left-img" v-if="userInfo.scene_id == 2">
						<u-avatar style="width: 88rpx;height: 88rpx;" :src="userInfo.user_info.head_img"></u-avatar>
					</view>
					<view class="left-img" v-if="userInfo.scene_id == 1">
						<u-avatar style="width: 88rpx;height: 88rpx;" :src="userInfo.user_info.logo"></u-avatar>
					</view>
					<view class="left-img" v-if="userInfo.scene_id == 3">
						<u-avatar style="width: 88rpx;height: 88rpx;" :src="userInfo.user_info.logo"></u-avatar>
					</view>
					<view>
						<view class="left-name">{{userInfo.user_info.name}}
							<span style="font-weight: 500;color: rgba(71, 71, 71, 1);">
								({{userInfo.scene_text}})</span>
						</view>
						<view class="left-text">{{userInfo.user_info.company.name}}</view>
					</view>
				</view>
				<view class="header-img">
					<image style="width: 376rpx;height: 376rpx;" src="@/static/workbench/workbench1.png"></image>
				</view>
			</view>
		</view>
		<view class="content-main">
			<view class="footer-name">常用工具</view>
			<view>
				<view class="box" @tap="toPage('/package_saleman/pages/Home/index')" v-if="userInfo.scene_id == 2">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench11.png"></image>
					</view>
					<view class="box-name">开单</view>
				</view>
				<view class="box" @tap="toPage('/package_tms/pages/Home/index')" v-if="userInfo.scene_id == 3">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench12.png"></image>
					</view>
					<view class="box-name">送货</view>
				</view>
				<view class="box" @tap="toPage('/package_dealer/pages/Home/index')" v-if="userInfo.scene_id == 2">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench13.png"></image>
					</view>
					<view class="box-name">收款</view>
				</view>
				<view class="box" @tap="toPage('/pages/Dalance/index')" v-if="userInfo.scene_id == 1">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench22.png"></image>
					</view>
					<view class="box-name">账户余额</view>
				</view>
				<view class="box" @tap="toPage('/package_saleman/pages1/Home/index')" v-if="userInfo.scene_id == 2">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench15.png"></image>
					</view>
					<view class="box-name">退货</view>
				</view>
				<!-- <view class="box" v-if="userInfo.scene_id == 2">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench16.png"></image>
					</view>
					<view class="box-name">换货</view>
				</view> -->
				<view class="box" v-if="userInfo.scene_id == 3"
					@tap="toPage('/package_tms/pages/Reconciliation/index')">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench18.png"></image>
					</view>
					<view class="box-name">对账</view>
				</view>
				<view class="box" v-if="userInfo.scene_id == 2"
					@tap="toPage('/package_dealer/pages/Reconciliation/index')">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench19.png"></image>
					</view>
					<view class="box-name">对账</view>
				</view>
				<view class="box" @tap="toPage('/pages/Inventory/index')" v-if="userInfo.scene_id == 2">
					<view class="box-img">
						<image style="width: 100rpx;height: 100rpx;" src="/static/workbench/workbench23.png"></image>
					</view>
					<view class="box-name">盘点</view>
				</view>
			</view>
		</view>
		<view class="content-footer">
			<view class="footer-name">辅助工具</view>
			<view>
				<!-- <view class="box" v-if="userInfo.scene_id != 1">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/workbench2.png"></image>
					</view>
					<view class="box-name">今日销售</view>
				</view> -->
				<!-- <view class="box">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/workbench3.png"></image>
					</view>
					<view class="box-name">应收款</view>
				</view> -->
				<view class="box" @tap="toPage('/pages/Management/index')" v-if="userInfo.scene_id == 1">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/经营报表.png"></image>
					</view>
					<view class="box-name">经营报表</view>
				</view>
				<!-- <view class="box" v-if="userInfo.scene_id != 1">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/workbench5.png"></image>
					</view>
					<view class="box-name">个人业绩</view>
				</view> -->
				<view class="box" @tap="toPage('/pages/Store/index')" v-if="userInfo.scene_id != 3">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/门店管理.png"></image>
					</view>
					<view class="box-name">门店管理</view>
				</view>
				<view class="box" @tap="toPage('/package_tms/pages/Store/index')" v-if="userInfo.scene_id == 3">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/门店管理.png"></image>
					</view>
					<view class="box-name">门店管理</view>
				</view>
				<!-- <view class="box">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/workbench17.png"></image>
					</view>
					<view class="box-name">账单对账</view>
				</view> -->
				<view class="box" @tap="toPage('/pages/Account/index')" v-if="userInfo.scene_id == 2">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/账期订单.png"></image>
					</view>
					<view class="box-name">账期订单</view>
				</view>
				<view class="box" @tap="toPage('/pages/Warehouse/index')" v-if="userInfo.scene_id == 1">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/库存管理.png"></image>
					</view>
					<view class="box-name">库存管理</view>
				</view>
				<view class="box" @tap="toPage('/pages/Warehouse/Incoming')" v-if="userInfo.scene_id == 1">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/出入库.png"></image>
					</view>
					<view class="box-name">出入库</view>
				</view>
				<view class="box" @tap="toPage('/pages/Logistics/index')" v-if="userInfo.scene_id == 1">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/物流配送.png"></image>
					</view>
					<view class="box-name">物流配送</view>
				</view>
				<!-- <view class="box">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/workbench9.png"></image>
					</view>
					<view class="box-name">账户管理</view>
				</view> -->
				<view class="box" @tap="toPage('/package_saleman/carpinPages/Personal/orderList')"
					v-if="userInfo.scene_id != 3">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/车销销售.png"></image>
					</view>
					<view class="box-name">车销销售</view>
				</view>
				<view class="box" @tap="toPage('/package_saleman/carpinPages1/Personal/orderList')"
					v-if="userInfo.scene_id != 3">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/车销退货.png"></image>
					</view>
					<view class="box-name">车销退货</view>
				</view>
				<view class="box" @tap="toPage('/package_saleman/pages/Personal/orderList')"
					v-if="userInfo.scene_id != 3">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/销售订单.png"></image>
					</view>
					<view class="box-name">销售订单</view>
				</view>
				<view class="box" @tap="toPage('/package_saleman/pages1/Personal/orderList')"
					v-if="userInfo.scene_id != 3">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/退货订单.png"></image>
					</view>
					<view class="box-name">退货订单</view>
				</view>
				<view class="box" @tap="toPage('/pages/Setting/index')">
					<view class="box-img">
						<image style="width: 60rpx;height: 60rpx;" src="/static/workbench/设置.png"></image>
					</view>
					<view class="box-name">设置</view>
				</view>
			</view>
		</view>
		<view class="content-bottom">
			<view class="bottom-name">微科软件技术支持</view>
			<view class="bottom-text">2023-v4.0</view>
		</view>
	</view>
</template>
<style scoped lang="scss">
	.content {
		width: 100%;
		height: 100vh;
		background: rgba(242, 243, 245, 1);
		padding-bottom: constant(safe-area-inset-bottom);
		/* 兼容iOS < 11.2 */
		padding-bottom: env(safe-area-inset-bottom);
		/* 兼容iOS 11.2及以上 */

		.content-header {
			width: 100%;
			overflow: hidden;
			background: linear-gradient(180deg, rgba(54, 116, 243, 0.3) 0%, rgba(53, 157, 242, 0.13) 51.39%, rgba(53, 97, 242, 0) 100%);
			padding: 30rpx;
			box-sizing: border-box;

			.header-name {
				text-align: center;
				padding-top: 80rpx;
				font-size: 32rpx;
				font-weight: 700;
				color: rgba(2, 14, 36, 1);
				box-sizing: border-box;
			}

			.header-left {
				display: flex;
				margin-top: 80rpx;

				.left-img {
					width: 88rpx;
					height: 88rpx;
					margin-right: 15rpx;
				}

				.left-name {
					font-size: 28rpx;
					font-weight: 700;
					color: rgba(1, 11, 31, 1);
					white-space: nowrap;
				}


				.left-text {
					font-size: 24rpx;
					font-weight: 500;
					color: rgba(150, 147, 147, 1);
					margin-top: 20rpx;
					white-space: nowrap;
				}
			}

			.header-img {
				width: 376rpx;
				height: 376rpx;
			}
		}

		.content-main {
			position: relative;
			width: 100%;
			height: 430rpx;
			border-radius: 24rpx 24rpx 0rpx 0rpx;
			background: rgba(255, 255, 255, 1);
			margin-top: -150rpx;
			z-index: 12;
			padding: 30rpx;
			box-sizing: border-box;

			.footer-name {
				font-size: 32rpx;
				font-weight: 700;
				color: rgba(1, 11, 31, 1);
			}

			.box {
				display: inline-block;
				margin-top: 25rpx;
				width: 25%;

				.box-img {
					margin: 0rpx auto;
					width: 100rpx;
					height: 100rpx;
				}

				.box-name {
					text-align: center;
					font-size: 28rpx;
					font-weight: 500;
					color: #444545;
					margin-top: 10rpx;
				}
			}
		}

		.content-footer {
			width: 100%;
			height: 632rpx;
			background: rgba(255, 255, 255, 1);
			margin-top: 20rpx;
			padding: 30rpx;
			box-sizing: border-box;

			.footer-name {
				font-size: 32rpx;
				font-weight: 700;
				color: rgba(1, 11, 31, 1);
			}

			.box {
				display: inline-block;
				margin-top: 40rpx;
				width: 20%;

				.box-img {
					margin: 0rpx auto;
					width: 60rpx;
					height: 60rpx;
				}

				.box-name {
					text-align: center;
					font-size: 24rpx;
					font-weight: 500;
					color: rgba(1, 11, 31, 1);
					margin-top: 10rpx;
				}
			}
		}

		.content-bottom {
			text-align: center;
			margin: 40rpx auto;

			.bottom-name {
				font-size: 28rpx;
				font-weight: 500;
				color: rgba(102, 99, 99, 1);
			}

			.bottom-text {
				font-size: 24rpx;
				font-weight: 500;
				color: rgba(158, 152, 152, 1);
				margin-top: 20rpx;
			}
		}
	}
</style>